﻿using System;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraNavBar;
using VASJ.Common;

namespace VASJ.Presentation.HeThong
{
    public partial class FrmCacNhom : DevExpress.XtraEditors.XtraForm
    {
        string clickedNavItem = string.Empty;

        public FrmCacNhom()
        {
            InitializeComponent();

            clickedNavItem = EnumExt.Description(VASJ.Common.DanhMuc.NavNhomKhachHang);
        }

        public void MouseHoverLabel(object sender)
        {
            var o = (LabelControl)sender;
            o.Cursor = Cursors.Hand;
            o.Appearance.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        }

        public void MouseLeaveLabel(object sender)
        {
            var o = (LabelControl)sender;
            o.Cursor = Cursors.Default;
            o.Appearance.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        }

        private void lblNhomKhachHang_Click(object sender, EventArgs e)
        {

        }

        private void lblNhomKhachHang_MouseHover(object sender, EventArgs e)
        {
            MouseHoverLabel(sender);
        }

        private void lblNhomKhachHang_MouseLeave(object sender, EventArgs e)
        {
            MouseLeaveLabel(sender);
        }

        private void lblNhomVuViec_MouseHover(object sender, EventArgs e)
        {
            MouseHoverLabel(sender);
        }

        private void lblNhomVuViec_MouseLeave(object sender, EventArgs e)
        {
            MouseLeaveLabel(sender);
        }

        private void lblNhomVatTu_MouseHover(object sender, EventArgs e)
        {
            MouseHoverLabel(sender);
        }

        private void lblNhomVatTu_MouseLeave(object sender, EventArgs e)
        {
            MouseLeaveLabel(sender);
        }

        private void lblNhomTaiSan_MouseHover(object sender, EventArgs e)
        {
            MouseHoverLabel(sender);
        }

        private void lblNhomTaiSan_MouseLeave(object sender, EventArgs e)
        {
            MouseLeaveLabel(sender);
        }

        private void lblNhomCongCu_MouseHover(object sender, EventArgs e)
        {
            MouseHoverLabel(sender);
        }

        private void lblNhomCongCu_MouseLeave(object sender, EventArgs e)
        {
            MouseLeaveLabel(sender);
        }

        private void FrmCacNhom_Load(object sender, EventArgs e)
        {

        }

        private void btnXoa_Click(object sender, EventArgs e)
        {

        }

        private void btnSua_Click(object sender, EventArgs e)
        {
            if (clickedNavItem == EnumExt.Description(VASJ.Common.DanhMuc.NavNhomKhachHang))
            {
                FrmCapNhatNhomKhachHang frm = new FrmCapNhatNhomKhachHang(VASJ.Common.TypeSubForms.Edit);
                frm.ShowDialog();
            }
        }

        private void btnMoi_Click(object sender, EventArgs e)
        {
            if (clickedNavItem == EnumExt.Description(VASJ.Common.DanhMuc.NavNhomKhachHang))
            {
                FrmCapNhatNhomKhachHang frm = new FrmCapNhatNhomKhachHang(VASJ.Common.TypeSubForms.New);
                frm.ShowDialog();
            }
        }

        private void navNhomKhachHang_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            var o = (NavBarItem)(sender);
            clickedNavItem = o.Name;
        }
    }
}